unit uCadPaciente;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Provider, SqlExpr, StdCtrls, Buttons, DB, DBClient, DBLocal,
  DBLocalS, ExtCtrls, Mask, DBCtrls, FacDbEdit, XPMenu;

type
  TfCadPaciente = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    GroupBox1: TGroupBox;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    FacDBEdit3: TFacDBEdit;
    FacDBEdit4: TFacDBEdit;
    FacDBEdit5: TFacDBEdit;
    FacDBEdit6: TFacDBEdit;
    FacDBEdit1: TFacDBEdit;
    FacDBEdit2: TFacDBEdit;
    GroupBox2: TGroupBox;
    Label14: TLabel;
    Label11: TLabel;
    Label12: TLabel;
    Label13: TLabel;
    Label15: TLabel;
    Label16: TLabel;
    Label3: TLabel;
    FacDBEdit7: TFacDBEdit;
    FacDBEdit8: TFacDBEdit;
    FacDBEdit9: TFacDBEdit;
    FacDBEdit10: TFacDBEdit;
    FacDBEdit11: TFacDBEdit;
    FacDBEdit12: TFacDBEdit;
    Panel4: TPanel;
    Panel1: TPanel;
    Label10: TLabel;
    Label17: TLabel;
    Label18: TLabel;
    FacDBEdit15: TFacDBEdit;
    FacDBEdit14: TFacDBEdit;
    FacDBEdit13: TFacDBEdit;
    GroupBox3: TGroupBox;
    Label19: TLabel;
    Label20: TLabel;
    FacDBEdit16: TFacDBEdit;
    FacDBEdit17: TFacDBEdit;
    SQLClientDataSet1: TSQLClientDataSet;
    SQLClientDataSet1COD_PACIENTE: TIntegerField;
    SQLClientDataSet1NOME: TStringField;
    SQLClientDataSet1SEXO: TStringField;
    SQLClientDataSet1COR: TStringField;
    SQLClientDataSet1EST_CIVIL: TStringField;
    SQLClientDataSet1DATA_NASC: TDateField;
    SQLClientDataSet1CATEGORIA: TStringField;
    SQLClientDataSet1PROFISSAO: TStringField;
    SQLClientDataSet1RUA: TStringField;
    SQLClientDataSet1NR: TStringField;
    SQLClientDataSet1COMPLEMENTO: TStringField;
    SQLClientDataSet1BAIRRO: TStringField;
    SQLClientDataSet1CIDADE: TStringField;
    SQLClientDataSet1UF: TStringField;
    SQLClientDataSet1CEP: TStringField;
    SQLClientDataSet1FONE: TStringField;
    SQLClientDataSet1FONE1: TStringField;
    SQLClientDataSet1FONE2: TStringField;
    SQLClientDataSet1CIC: TStringField;
    SQLClientDataSet1RG: TStringField;
    btnSair: TBitBtn;
    DtSrc: TDataSource;
    XPMenu1: TXPMenu;
    FacDBEdit18: TFacDBEdit;
    FacDBEdit19: TFacDBEdit;
    FacDBEdit20: TFacDBEdit;
    FacDBEdit21: TFacDBEdit;
    Label21: TLabel;
    SQLClientDataSet1HISTORICO: TMemoField;
    SQLClientDataSet1SUB_CATEGORIA: TStringField;
    procedure btnSairClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fCadPaciente: TfCadPaciente;

implementation

uses UDM, uConsulta;

{$R *.dfm}

procedure TfCadPaciente.btnSairClick(Sender: TObject);
begin
  Close;
end;

procedure TfCadPaciente.FormShow(Sender: TObject);
begin
  if SQLClientDataSet1.Active then
    SQLClientDataSet1.Close;
    SQLClientDataSet1.Params[0].AsInteger :=
    dm.cds_consultaCOD_PACIENTE.AsInteger;
    SQLClientDataSet1.Open;
end;

procedure TfCadPaciente.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if SQLClientDataSet1.Active then
    SQLClientDataSet1.Close;
end;

end.
